#pragma once
#ifndef RC_INVOKED
#include <cstdlib>
#include "compiler.h"
#include "Scintilla.h"
#include "SciLexer.h"

#define TAB_WIDTH_4		4
#define TAB_WIDTH_2		2
#define TAB_WIDTH_MIN	1
#define TAB_WIDTH_MAX	256
#define INDENT_WIDTH_4		4
#define INDENT_WIDTH_2		2
#define INDENT_WIDTH_MIN	0
#define INDENT_WIDTH_MAX	256

#define MAX_EDITSTYLE_VALUE_SIZE	128
#define MAX_EDITLEXER_EXT_SIZE		256
#define MAX_LEXER_STYLE_EDIT_SIZE	256
#define MAX_EDITLEXER_NAME_SIZE		64
#define MAX_EDITSTYLE_NAME_SIZE		64

enum {
	StyleTheme_Default = 0,
	StyleTheme_Dark = 1,
	StyleTheme_Max = StyleTheme_Dark,
};

//Lexer Enum++Autogenerated -- start of section automatically generated
enum {
	LexerAttr_Default = 0,
	LexerAttr_TabAsSpaces = 1 << 0,
	LexerAttr_NoGlobalTabSettings = 1 << 1,
	LexerAttr_NoLineComment = 1 << 2,
	LexerAttr_NoBlockComment = 1 << 3,
	LexerAttr_IndentBasedFolding = 1 << 4,
	LexerAttr_IndentLookForward = 1 << 5,
	LexerAttr_PrintfFormatSpecifier = 1 << 6,
	LexerAttr_AngleBracketGeneric = 1 << 7,
	LexerAttr_CppPreprocessor = 1 << 8,
	LexerAttr_CharacterPrefix = 1 << 9,
	LexerAttr_EscapePunctuation = 1 << 10,
	LexerAttr_PlainTextFile = 1 << 11,
};

enum {
	KeywordAttr_Default = 0,
	KeywordAttr_MakeLower = 1,
	KeywordAttr_PreSorted = 2,
	KeywordAttr_NoLexer = 4,
	KeywordAttr_NoAutoComp = 8,
};
//Lexer Enum--Autogenerated -- end of section automatically generated

#define LexerAttr_GetTabAsSpaces(attr)			((attr) & LexerAttr_TabAsSpaces)
#define LexerAttr_GetGlobalTabSettings(attr)	(!((attr) & LexerAttr_NoGlobalTabSettings))
#define KeywordAttr32(index, value)		((value) << ((index)*4))
#define KeywordAttr64(index, value)		(static_cast<uint64_t>(value) << ((index)*4))

struct EDITSTYLE {
	const unsigned iStyle;
	// set with EDITSTYLE_HOLE() or EDITSTYLE_HOLEX()
		const uint16_t rid;
		const uint16_t iNameLen;
		const wchar_t * const pszName;
		wchar_t *szValue;
	const wchar_t * const pszDefault;
};

#define EDITSTYLE_BufferSize(iStyleCount)	((iStyleCount) * MAX_EDITSTYLE_VALUE_SIZE * sizeof(wchar_t))
#define	MULTI_STYLE(a, b, c, d)			((a) | ((b) << 8) | ((c) << 16) | ((d) << 24))
#define	MULTI_STYLE8(a, b, c, d, e, f, g, h) \
	(MULTI_STYLE(a, b, c, d) | (static_cast<uint64_t>(MULTI_STYLE(e, f, g, h)) << 32))

struct KEYWORDLIST {
	const char * const pszKeyWords[KEYWORDSET_MAX + 1];
};

struct EDITLEXER {
	const int iLexer;
	const int rid;
	// default settings for this scheme, auto generated from LexerConfig.py
		const uint32_t lexerAttr;
		const uint8_t defaultTabWidth;
		const uint8_t defaultIndentWidth;
		const uint8_t defaultFoldLevelMask;
		const uint8_t defaultFoldIgnoreInner;

		const uint8_t escapeCharacterStart;
		const uint8_t escapeCharacterStyle;
		const uint8_t formatSpecifierStyle;
		const uint8_t autoIdentWordStyle;
		const uint8_t characterLiteralStyle;
		const uint8_t noneSingleQuotedStyle;
		const uint8_t operatorStyle;
		const uint8_t operatorStyle2;

		const uint64_t keywordAttr;

		const uint8_t commentStyleMarker;
		const uint8_t stringStyleFirst;
		const uint8_t stringStyleLast;
	// set with EDITLEXER_HOLE() or EDITLEXER_TEXT()
		uint8_t iStyleTheme;
		bool bStyleChanged;
		bool bUseDefaultCodeStyle;
		int iFavoriteOrder;

		const uint16_t iStyleCount;
		const uint16_t iNameLen;
		const wchar_t * const pszName;
		wchar_t *szExtensions;
		wchar_t *szStyleBuf;
	const wchar_t * const pszDefExt;
	const KEYWORDLIST * const pKeyWords;
	EDITSTYLE * const Styles;
};

using PEDITLEXER = EDITLEXER *;
using LPCEDITLEXER = const EDITLEXER *;

#endif  // !RC_INVOKED

// NP2LEX_, resource id for EDITLEXER.
#define NP2LEX_TEXTFILE		63000	// SCLEX_NULL		Text File
#define NP2LEX_CPP			63001	// SCLEX_CPP		C/C++ Source
#define NP2LEX_JAVA			63002	// SCLEX_JAVA		Java Source
#define NP2LEX_CSHARP		63003	// SCLEX_CSHARP		C# Source
#define NP2LEX_JAVASCRIPT	63004	// SCLEX_JAVASCRIPT	JavaScript
#define NP2LEX_RESOURCESCRIPT		63005	// SCLEX_CPP		Resource Script
//#define NP2LEX_IDL		63006	// SCLEX_CPP		Interface Definition Language
#define NP2LEX_DLANG		63007	// SCLEX_DLANG		D Source
#define NP2LEX_ASYMPTOTE	63008	// SCLEX_ASYMPTOTE	Asymptote Code
#define NP2LEX_CIL			63009	// SCLEX_CIL		CIL Assembly
//#define NP2LEX_OBJC		63010	// SCLEX_CPP		Objective C/C++
#define NP2LEX_ACTIONSCRIPT	63011	// SCLEX_JAVASCRIPT	ActionScript
#define NP2LEX_HAXE			63012	// SCLEX_HAXE		Haxe Script
#define NP2LEX_GROOVY		63013	// SCLEX_GROOVY		Groovy Script
#define NP2LEX_SCALA		63014	// SCLEX_SCALA		Scala Script
#define NP2LEX_GO			63015	// SCLEX_GO			Go Source
#define NP2LEX_GRADLE		63016	// SCLEX_GROOVY		Gradle Build Script

#define NP2LEX_VISUALBASIC	63021	// SCLEX_VISUALBASIC	Visual Basic
#define NP2LEX_FSHARP		63022	// SCLEX_FSHARP		F# Source
#define NP2LEX_ASM			63023	// SCLEX_ASM		Assembler Source
#define NP2LEX_PASCAL		63024	// SCLEX_PASCAL		Pascal Source
#define NP2LEX_XML			63025	// SCLEX_XML		XML Document
#define NP2LEX_HTML			63026	// SCLEX_HTML		Web Source Code
#define NP2LEX_CSS			63027	// SCLEX_CSS		CSS Style Sheet
#define NP2LEX_SQL			63028	// SCLEX_SQL		SQL Query
#define NP2LEX_PHP			63029	// SCLEX_PHPSCRIPT	PHP Script
#define NP2LEX_VBSCRIPT		63030	// SCLEX_VBSCRIPT	VBScript
#define NP2LEX_PERL			63031	// SCLEX_PERL		Perl Script
#define NP2LEX_PYTHON		63032	// SCLEX_PYTHON		Python Script
#define NP2LEX_RUBY			63033	// SCLEX_RUBY		Ruby Script
#define NP2LEX_LUA			63034	// SCLEX_LUA		Lua Script
#define NP2LEX_TCL			63035	// SCLEX_TCL		Tcl Script
#define NP2LEX_BATCH		63036	// SCLEX_BATCH		Batch File
#define NP2LEX_BASH			63037	// SCLEX_BASH		Shell Script
#define NP2LEX_POWERSHELL	63038	// SCLEX_POWERSHELL	PowerShell Script
#define NP2LEX_AUTOIT3		63039	// SCLEX_AUTOIT3	AutoIt3 Script
#define NP2LEX_MATLAB		63040	// SCLEX_MATLAB		MATLAB Code
#define NP2LEX_FORTRAN		63041	// SCLEX_FORTRAN	Fortran Source
#define NP2LEX_LATEX		63042	// SCLEX_LATEX		LaTeX File
#define NP2LEX_VHDL			63043	// SCLEX_VHDL		VHDL Source
#define NP2LEX_VERILOG		63044	// SCLEX_VERILOG	Verilog HDL Source
#define NP2LEX_MAKEFILE		63045	// SCLEX_MAKEFILE	Makefile
#define NP2LEX_CMAKE		63046	// SCLEX_CMAKE		CMake Script
#define NP2LEX_INNOSETUP	63047	// SCLEX_INNOSETUP	Inno Setup Script
#define NP2LEX_INI			63048	// SCLEX_PROPERTIES	Ini Config File
#define NP2LEX_CONFIG		63049	// SCLEX_CONFIG		Config File
#define NP2LEX_DIFF			63050	// SCLEX_DIFF		Diff/Patch

#define NP2LEX_AWK			63051	// SCLEX_AWK		Awk Script
#define NP2LEX_JAMFILE		63052	// SCLEX_JAMFILE	Jamfile
#define NP2LEX_GRAPHVIZ		63053	// SCLEX_GRAPHVIZ	GraphViz Dot
#define NP2LEX_JSON			63054	// SCLEX_JSON		JSON Document
#define NP2LEX_SMALI		63055	// SCLEX_SMALI		Android Smali
#define NP2LEX_NSIS			63056	// SCLEX_NSIS		Nsis Setup Script
#define NP2LEX_TEXINFO		63057	// SCLEX_TEXINFO	Texinfo File
#define NP2LEX_LISP			63058	// SCLEX_LISP		Lisp Script
#define NP2LEX_VIM			63059	// SCLEX_VIM		Vim Script
#define NP2LEX_LLVM			63060	// SCLEX_LLVM		LLVM IR
#define NP2LEX_OCTAVE		63061	// SCLEX_MATLAB		Octave Code
#define NP2LEX_SCILAB		63062	// SCLEX_MATLAB		Scilab Code
#define NP2LEX_RLANG		63063	// SCLEX_RLANG		R Code
#define NP2LEX_MATHEMATICA	63064	// SCLEX_MATHEMATICA	Mathematica
#define NP2LEX_SAS			63065	// SCLEX_SAS		SAS File
#define NP2LEX_JULIA		63066	// SCLEX_JULIA		Julia Script
#define NP2LEX_RUST			63067	// SCLEX_RUST		Rust Source
#define NP2LEX_KOTLIN		63068	// SCLEX_KOTLIN		Kotlin Source
#define NP2LEX_YAML			63069	// SCLEX_YAML		YAML Document
#define NP2LEX_WASM			63070	// SCLEX_WASM		WebAssembly
#define NP2LEX_TOML			63071	// SCLEX_TOML		TOML File
#define NP2LEX_GN			63072	// SCLEX_GN			GN Build Script
#define NP2LEX_DART			63073	// SCLEX_DART		Dart Source
#define NP2LEX_REBOL		63074	// SCLEX_REBOL		Rebol Script
#define NP2LEX_SWIFT		63075	// SCLEX_SWIFT		Swift Source
#define NP2LEX_TYPESCRIPT	63076	// SCLEX_JAVASCRIPT	TypeScript
#define NP2LEX_APDL			63077	// SCLEX_APDL		ANSYS APDL
#define NP2LEX_ABAQUS		63078	// SCLEX_APDL		ABAQUS
#define NP2LEX_BLOCKDIAG	63079	// SCLEX_GRAPHVIZ	blockdiag
#define NP2LEX_CSV			63080	// SCLEX_CSV		CSV File
#define NP2LEX_NIM			63081	// SCLEX_NIM		Nim Script
#define NP2LEX_ZIG			63082	// SCLEX_ZIG		Zig Source
#define NP2LEX_OCAML		63083	// SCLEX_OCAML		OCaml Source
#define NP2LEX_HASKELL		63084	// SCLEX_HASKELL	Haskell Source
#define NP2LEX_CANGJIE		63085	// SCLEX_CANGJIE	Cangjie Source
#define NP2LEX_WINHEX		63086	// SCLEX_WINHEX		WinHex Script
#define NP2LEX_AVISYNTH		63087	// SCLEX_AVISYNTH	AviSynth Script
#define NP2LEX_TEKEXTHEX	63088	// SCLEX_TEKEXTHEX	Tektronix extended HEX
#define NP2LEX_INTELHEX		63089	// SCLEX_INTELHEX	Intel HEX
#define NP2LEX_SRECORD		63090	// SCLEX_SRECORD	Motorola S-Record
#define NP2LEX_SRT			63091	// SCLEX_SRT		Srt Subtitle
#define NP2LEX_MARKDOWN		63092	// SCLEX_MARKDOWN	Markdown
#define NP2LEX_REGISTRY		63093	// SCLEX_REGISTRY	Registry File
#define NP2LEX_COFFEESCRIPT	63094	// SCLEX_COFFEESCRIPT	CoffeeScript
#define NP2LEX_AUTOHOTKEY	63095	// SCLEX_AUTOHOTKEY	AutoHotkey Script

// special lexers
#define NP2LEX_ANSI			63196	// SCLEX_NULL		ANSI Art
#define NP2LEX_2NDTEXTFILE	63197	// SCLEX_NULL		2nd Text File
#define NP2LEX_GLOBAL		63200	// SCLEX_NULL		Global Styles
